package org.jclosures.function.base;

import org.jclosures.function.Function1;
import org.jclosures.function.Function2;
import org.jclosures.function.Function3;

public abstract class AbstractFunction3<PT1, PT2, PT3, RT> implements
		Function3<PT1, PT2, PT3, RT> {

	public Function2<PT2, PT3, RT> curry(final PT1 arg1) {
		return new Function2<PT2, PT3, RT>() {
			public RT apply(PT2 arg2, PT3 arg3) {
				return AbstractFunction3.this.apply(arg1, arg2, arg3);
			}

			public Function1<PT3, RT> apply(final PT2 arg2) {
				return new Function1<PT3, RT>() {
					public RT apply(final PT3 arg3) {
						return AbstractFunction3.this.apply(arg1, arg2, arg3);
					};

					@Override
					public String toString() {
						return "Closure function with bind { arg1 : "
								+ arg1 + ", arg2 : " + arg2 + "}";
					}
				};
			};

			@Override
			public String toString() {
				return "Closure function with bind { arg1 : " + arg1
						+ "}";
			}
		};
	};
}